TREES
Photo by Marc Babin on Unsplash
One of the simplest ways to get an idea of one trillion dollars is to consider the amount in terms of the passage of time.
One trillion seconds equals thirty-two thousand years…
— Geoff Davis
# Load data
df = read.csv("./archetypes/trillions/trillions.csv", header = TRUE, stringsAsFactors = FALSE) # read text file
df
df_wrangle <- df
df_wrangle$category <- factor(df_wrangle$category)
df_wrangle
category_palette <- c(
'helping' = '#4FC3F7',
'hoarding' = '#00BCD4',
'earning' = '#26A69A',
'losing' = '#FF7043',
'fighting' = '#F44336',
'spending' = '#FBC02D',
'saving' = '#8BC34A',
'owing' = '#FF9800',
'banking' = '#66BB6A',
'winning' = '#5C6BC0'
)
# Layouts
# squarified" (the default), "scol", "srow" or "fixed"
# Simple
v1 <- ggplot(df_wrangle, aes(area = trillion_usd, fill = category)) +
geom_treemap(color = "#ffffff") +
scale_fill_manual(values = category_palette) +
theme_minimal() +
theme(legend.position = "bottom")
girafe(ggobj = v1, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0))
)
# Labeled
v2 <- ggplot(df_wrangle, aes(area = trillion_usd, fill = category, label = what)) +
geom_treemap(color = "#ffffff") +
geom_treemap_text(fontface = "italic", colour = "white", place = "centre", grow = TRUE) +
scale_fill_manual(values = category_palette) +
theme_minimal() +
theme(legend.position = "bottom")
girafe(ggobj = v2, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0))
)